/**
 * 
 */
package com.mango.mstock.support.db;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

/**
 * @author richard
 *
 */
public class DBHelper extends SQLiteOpenHelper {
	
	private static final String DATABASE_NAME = "mstock.db";  
    private static final int DATABASE_VERSION = 1;  
    
    private static final String DB_SCHEMA_DEF_MYFAVORS = 
    		"CREATE TABLE IF NOT EXISTS myfavors( " +
    		    "_id INTEGER PRIMARY KEY AUTOINCREMENT, " +
    			"code CHAR(6), " +
    		    "name VARCHAR(50), " +
    			"yesterdayprice float, " +
    			"latestprice float, " +
    			"updatedate VARCHAR(50) " +
    		")";

	public DBHelper(Context context) {
		super(context, DATABASE_NAME, null, DATABASE_VERSION);  
	}

	@Override
	public void onCreate(SQLiteDatabase db) {
		 db.execSQL(DB_SCHEMA_DEF_MYFAVORS);
	}

	@Override
	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
//		db.execSQL("ALTER TABLE myfavors ADD COLUMN other STRING")
	}

}
